/**
 * ExportService.java
 * Version 1.0.0
 * Created on 2019年1月22日
 *
 */
package com.yincheng.oes.business.exam.export;

import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yincheng.oes.business.exam.export.entity.PaperDetailStatistics;
import com.yincheng.oes.business.exam.export.mapper.ExportMapper;
import com.yincheng.oes.business.util.ExportWord;

import freemarker.template.TemplateException;

/**
 * @author yangsy
 * @version 1.0.0
 * @since
 * 创建时间：2019年1月22日
 * <p>
 * 功能描述：
 * <p>
 * 邮箱地址：446948434@qq.com
 */
@Service
public class ExportService {

    @Autowired
    private ExportMapper exportMapper;

    public void exportPaperStatisticsByWord(String paperId, OutputStream os) throws IOException, TemplateException {
        List<PaperDetailStatistics> list = exportMapper.selectByPaperId(paperId);
        Map<String, Object> dataMap = new HashMap<String, Object>();
        dataMap.put("details", list);
        String fileName = "试卷详细信息统计导出.ftl";

        ExportWord.exportWord(dataMap, fileName, os);
    }
}
